<html>
 <head>
    <title>[var.TITLE]</title>
    <link href="[var.ROOT_CSS_DIR]/main.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <link href="[var.ROOT_CSS_DIR]/facet/style.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <script type="text/javascript" src="[var.ROOT_DIR]js/common.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/doiMenuDOM.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/functions.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.php"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.cfg"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsformgrid.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmasks.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsverify.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsinit.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jquery.min.js"></script>
 </head>
 <body bgcolor="FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> 
    <table border="0" cellspacing="0" cellpadding="0" width="100%" align="[var.POSITION]">
        <tr>
            <td>[tbs_include.onshow;file=[var.HTMLHeader];getob;]</td>
        </tr>
        <tr>
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <tr>
                    <td background="[var.ROOT_IMG_DIR]/back-menu.gif">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td>
                                <script language="JavaScript" type="text/JavaScript">menu.Build();</script>
                          </td>
                          <td class="head-login">Login as [var.USERPROFILE_NAME]</td>
                        </tr>
                      </table>
                    </td>
                </tr>

                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
            </table>
            </td>
        </tr>
        <tr height="100%">
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
                <tr valign="top">
                    <td width="100%">
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                                <td class="head-path"></td>
                                <td class="corner-date">[var.CORNER_DATE]</td>
                            </tr>
                        </table>
                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="FacetHeaderContent" >.:[var.SubHeaderTitle]:.</td>
                            </tr>
                        </table>

                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                        <form method="post" action="[var.FormAction]" name="[var.HTMLFormName]" >
                            <tr>
                                <td class="contentTitleOperational">
                                Menu
                                </td>
                            </tr>
                            <tr>
                                <td class="contentOperational">
                                <table cellspacing="2" cellpadding="0">
                                 <tr>
                                   <td>
                                    <input type="button" name="Action" value="<<Back" class="button" onClick="self.location.replace('[sys.script_name]')">
                                   </td>
                                   <td>
									 <input name="FormAction" type="submit" value="Save" class="button" ONCLICK="return checkVerification();">
								   </td>
                                   <td>
                                     <input type="button" name="Action" value="Done" class="button" onClick="self.location.replace('[var.SERVER_URL]')">
                                   </td>
                                   <!--
                                   <td>
									 <input type="button" name="Action" value="Print to PDF" class="button" onClick="return SubmitPDF();">
								   </td>
								   -->
                                 </tr>
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="contentOperational">
                         
                         
                         
                         <!--TABLE MASTER-->       
						 <table width="1400" border="0">
							 <tr>
							 <!--ROW TABLE MASTER--> 
								 <td width="45%" valign="top"> 
                                 <!--COL TABLE MASTER-->  
                                  
                        <!-- FORM SECTION -->
                        <table border="0" cellspacing="0" cellpadding="0">

                        
                              <tr>
                                <td class="fieldCaption" align="right">Job Order Code</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                    
                                     <span style="font-weight:bold;font-size:13px;">[headblv.jo_code;noerr]</span>
                                     <input type="hidden" name="jo_id" value="[var.jo_id;noerr]"> 
                                </td>
                                <!--<td class="fieldCaption"><input type="text" name="(bln.project_id)" value="[headblv.project_id;noerr]" maxlength="255" size="10" onblur='[var.InitFunction]' onkeyup="this.value=this.value.toUpperCase()" class="input" [tbs_check;if [var.FormMode]=Edit;then 'readonly';else '']></td>-->
                              </tr>
                              
                              <tr>
                                <td class="fieldCaption" align="right">Project Name</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                    [headblv.project_name]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Customer</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                   [headblv.CUNAME;noerr]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Doc. Receive From</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                   
									[headblv.nama;noerr]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Commencing Delivery</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                                                        
                                     <input type="text" name="commencing_delivery"  maxlength="255" size="25" class="input" value="[tbs_check;if [var.FormMode]=Edit;then [headblv.commencing_delivery;frm='dd/mm/yyyy';noerr]; else '']" maxlength="255" size="10" class="input" >
                                     <a href="javascript:void(0)" onclick="gfPop.fPopCalendar([var.HTMLFormName].commencing_delivery);return false;" hidefocus>
                                     <img name="popcal" align="absMiddle" src="[var.ROOT_DIR]js/Calendar/pop/calbtn.gif" width="34" height="22" border="0" alt=""></a>
                                </td>                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Completed Delivery</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                                                         
                                     <input type="text" name="completed_delivery"  maxlength="255" size="25" class="input" value="[tbs_check;if [var.FormMode]=Edit;then [headblv.completed_delivery;frm='dd/mm/yyyy';noerr]; else '']" maxlength="255" size="10" class="input" >
                                     <a href="javascript:void(0)" onclick="gfPop.fPopCalendar([var.HTMLFormName].completed_delivery);return false;" hidefocus>
                                     <img name="popcal" align="absMiddle" src="[var.ROOT_DIR]js/Calendar/pop/calbtn.gif" width="34" height="22" border="0" alt=""></a>
                                </td>                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Cargo Description</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                     <textarea name="cargo_desc" cols="25" rows="4" id="input">[headblv.cargo_desc;noerr;]</textarea>
                                </td>                                
                              </tr>
                                                                                          

                         </table>
                         <!-- END FORM SECTION -->
                         
                         
                         <!--END COL TABLE MASTER-->  
                         </td>
                         
                         <!--COL TABLE MASTER-->  
                         <td valign="top">
                         
                              &nbsp;
                         
                          </td>
                          <!--END COL TABLE MASTER-->  
                                
                          
                          </tr>
                          <!--END ROW TABLE MASTER-->        
                            
                        </table>
                        <!--END TABLE MASTER-->
                        
                        
                        
                         <!--TABLE MASTER 3-->       
						 <table width="1390" border="0">
						
                          
                          <tr>
							 <!--ROW TABLE MASTER 4--> 
								 <td valign="top"> 
                                 <!--COL TABLE MASTER 4-->  
                          
                          
                            <!--GRID-->

							<hr size="1" color="DFDFDF">
							<div id="spanHeader" style="height: 25px; vertical-align: top; overflow-y: noscroll;">
							<table border="0" width="1400" cellpadding="3" cellspacing="1" class="FacetFormTABLEOperational" align="left">

									<tr>
											<td nowrap class="FacetColumnTDOperational" align="center" width="35">X</td>
											<td nowrap class="FacetColumnTDOperational" align="center" width="35">No.</td>
											<td nowrap class="FacetColumnTDOperational" align="center" width="280">ACTIVITY</td>
											<td nowrap class="FacetColumnTDOperational" align="center" width="170">DATE</td>
											<td nowrap class="FacetColumnTDOperational" align="center" width="165">TO</td>									
											<td nowrap class="FacetColumnTDOperational" align="center" width="450">DESCRIPTION</td>
											<td nowrap class="FacetColumnTDOperational" align="center">FROM</td>
									</tr>
							</table>
							</div>




							<div id="spanDetail" class="tariffgrid" style="height: 200px; vertical-align: top; overflow: auto;">

								<!--Edited by van Smith-->

								<table border="0" width="1400" cellpadding="3" cellspacing="1" class="FacetFormTABLEOperational" align="left">

									<tr id="[blg.#]" style="display:[blg._display;noerr]">

											<td nowrap class="FacetDataTDOperational" align="center" width="35">
											  <input type="checkbox" name="txtCheck[blg.#]" value="[blg.act_id;noerr]" class="inputRadio">
											  <input type=hidden name="dk[blg.#]" value="D">
											</td>
											
											<td nowrap class="FacetDataTDOperational" align="right" width="35" align="right">
											  [blg.#;block=tr]. 
											  <input type="hidden" name="jo_id[blg.#]" value="[tbs_check;if [var.jo_id;noerr]!='';then [var.jo_id;noerr] ;else '']">
											</td>
											
											<td nowrap class="FacetDataTDOperational" align="center" width="280">
																					  
                                                   <select name="activitiesList[blg.#]" id="input" onchange="GetActivities(this.value,'[blg.#]');">
													  <option value="" selected>Activities</option>
													  <option value="1">Select</option>
												   </select>
												   <input type="hidden" name="activities_id[blg.#]" value="[blg.activities_id;noerr]" class="input">
												   <input type="hidden" name="activities_code[blg.#]" value="[blg.activities_code;noerr]" class="input">
												   <input type="text" name="activities_name[blg.#]" value="[blg.actname;noerr]" maxlength="255" size="20" class="input" readonly>
													   
											</td>
																					 
											<td nowrap class="FacetDataTDOperational" align="center" width="170">
																					  
                                                <input type="text" name="date_act[blg.#]"  maxlength="255" size="10" id="input" class="gridBox" value="[tbs_check;if [var.FormMode]=Edit;then [blg.date_act;frm='dd/mm/yyyy';noerr]; else [sys.now;frm='dd/mm/yyyy']]" maxlength="255" size="10">
                                                <a href="javascript:void(0)" onclick="gfPop.fPopCalendar([var.HTMLFormName].date_act[blg.#]);return false;" hidefocus>
                                                <img name="popcal" align="absMiddle" src="[var.ROOT_DIR]js/Calendar/pop/calbtn.gif" width="34" height="22" border="0" alt=""></a> 												   
											   
											</td>
											
											<td nowrap class="FacetDataTDOperational" align="center" width="165">
											   <input type="text" name="to_act[blg.#]" value="[blg.to_act;noerr]" id="input" size="17" >
											</td>
											
											<td nowrap class="FacetDataTDOperational" align="center" width="450">
											   <input type="text"  name="uraian_act[blg.#]" value="[blg.uraian_act;noerr]" id="input" size="45" >
											</td>
											
											<td nowrap class="FacetDataTDOperational" align="center">
											   <input type="text" name="from_act[blg.#]" value="[blg.from_act;noerr]" id="input" size="17" >
											</td>
											
										</tr>
								</table>

								<!--End Edited by van Smith-->

							</div>

							<!--END GRID-->
                          
                          
                          </td>
                          <!--END COL TABLE MASTER 4-->  
                                
                          
                          </tr>
                          <!--END ROW TABLE MASTER 4-->     
                          
                          
                             
                             
                            
                        </table>
                        <!--END TABLE MASTER 4-->
                        
                        


                        <!--BUTTON-->
                        <div id="spanButton" style="height: 35px; vertical-align: top; overflow-y: noscroll;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLEOperational" align="left">
                                <tr>
                                    <td align="right" class="FacetColumnTDOperational">

                                           <table border="0" cellspacing="2" cellpadding="0">
                                                   <tr>
                                                           <td>
                                                             <input name="FormAction" type="button" value="Next Line" class="button" onClick="return (AddFormGridProject(this,'[var.HTMLFormName].date_act'))">
                                                           </td>
                                                           <td>
                                                                <input name="FormAction" type="button" value="Delete Line" class="button" onClick="DeleteLines()">
                                                           </td>
                                                           <td>
                                                             <input name="FormAction" type="submit" value="Save" class="button" ONCLICK="return checkVerification();">
                                                           </td>
                                                          
                                                           <td>
                                                             <input name="FormAction" type="submit" value="Cancel" class="button" onClick="self.location.replace('[sys.script_name]')">
                                                           </td>
                                                   </tr>
                                           </table>


                                    </td>
                                        </td>
                                </tr>

                        </table>
                        </div>

                        <!--END BUTTON-->


                    </td>
                </tr>

                </form>

            </table>
            </td>
        </tr>
        <tr>
            <td>
            <br>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="footer1"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <!--tr>
                    <td class="footer2">Prototype Test - Web Application</td>
                </tr-->
            </table>
            </td>
        </tr>
    </table>
 </body>


 <iframe width="174" height="189" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="[var.ROOT_DIR]js/Calendar/pop/ipopeng.htm" scrolling="no" frameborder="0" style="LEFT: -500px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; Z-INDEX: 999"></iframe>

 <script>
 [var.InitFunction]


 SetDK(1,'K');
 document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");

 function SetDK(idx,val) {
   //eval("dk = document.[var.HTMLFormName].dk"+idx+".value;");
   //if (dk=='') eval("document.[var.HTMLFormName].dk"+idx+".value='"+val+"';");
   return true;
 }
 
 
 function GetActivities(val,no_urut) {
      newwin = window.open("ais_transaction_actnrlist.php?FormName=[var.HTMLFormName]&SendToBack=1&PageMode=shippingActForm&no_urut="+ no_urut + "&jo_id=" + [var.jo_id], "toolcalc","height=400,width=640,noscroll,resizable");
 }
 

function IsNumeric(sText)
{
   var ValidChars = "0123456789.,";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}


function checkVerification()
{
	var checksum = 0;
	var errorMsg = "";
	
	/*
	var doc_ref = eval("document.[var.HTMLFormName].doc_ref.value");
	var project_id = eval("document.[var.HTMLFormName].project_id.value");
	var debtur = eval("document.[var.HTMLFormName].debtur.value");
	var staff_id = eval("document.[var.HTMLFormName].staff_id.value");
	var bl_no = eval("document.[var.HTMLFormName].bl_no.value");
	var invoice_no = eval("document.[var.HTMLFormName].invoice_no.value");
	var vessel = eval("document.[var.HTMLFormName].vessel.value");
	var jo_appv_status = eval("document.[var.HTMLFormName].jo_appv_status.value");
	
	if(doc_ref == "")
	{
		errorMsg+= "Document Reference should not empty\n";
	}
	
	if(project_id == "")
	{
		errorMsg+= "Project should not empty\n";
	}
	
	if(debtur == "")
	{
		errorMsg+= "Customer should not empty\n";
	}
	
	if(staff_id == "")
	{
		errorMsg+= "Staff should not empty\n";
	}
	
	if(bl_no == "")
	{
		errorMsg+= "BL Number should not empty\n";
	}
	
	if(invoice_no == "")
	{
		errorMsg+= "Invoice Number should not empty\n";
	}
	
	if(vessel == "")
	{
		errorMsg+= "Vessel should not empty\n";
	}
	
	if(jo_appv_status == "")
	{
		errorMsg+= "Approval should not empty\n";
	}
	
	
	$(".gridBox:visible").each(function(n) {
        lastname = this.name;
        lastname = lastname.substring(3);    
        lastname = parseInt(lastname);
        
        var services_id = eval("document.[var.HTMLFormName].services_id"+lastname+".value");
        var qty = eval("document.[var.HTMLFormName].qty"+lastname+".value");
        var unit = eval("document.[var.HTMLFormName].unit"+lastname+".value");
        var curr = eval("document.[var.HTMLFormName].curr"+lastname+".value");
        var rate = eval("document.[var.HTMLFormName].rate"+lastname+".value");
        var tax_rate = eval("document.[var.HTMLFormName].tax_rate"+lastname+".value");
        var payment_status_id = eval("document.[var.HTMLFormName].payment_status_id"+lastname+".value");
        
        if((services_id != "") && (qty != "") && (unit != "") && (curr != "") && (rate != "") && (tax_rate != "") && (payment_status_id != ""))
        {    
          checksum++;
        }
                
    });
    
    if(checksum < 1)
    {
		errorMsg+= "Your grid is not complete\n";
	}
    
    if(errorMsg != "")
    {
		alert(errorMsg);
		return false;
	}
	
	else
	{
		return true;
	}
    */
    
    return true;
	
}


 function DeleteLines(){
    $("input[name^=txtCheck]").each(
      function(){
        if($(this).attr('checked')) {
            //alert($(this).val());
            var num = String($(this).attr('name')).replace('txtCheck','');
            //alert('num: ' + num);
            $('tr#'+num).remove();
        }
      }
    );
 }
 
 
 function DeleteLinesCargo(){
    $("input[name^=txtCheckCargo]").each(
      function(){
        if($(this).attr('checked')) {
            //alert($(this).val());
            var num = String($(this).attr('name')).replace('txtCheckCargo','');
            //alert('num: ' + num);
            $('tr#rowCargo'+num).remove();
        }
      }
    );
 }


function SubmitPDF() {	
	  str_url = '[sys.script_name]?PageMode=PDF&jo_id=[var.jo_id]';
	  OpenPDF(str_url);
	  return false;	
}


 function GetServices(val,no_urut) {
      newwin = window.open("ais_transaction_serviceslist.php?FormName=[var.HTMLFormName]&no_urut="+no_urut,"toolcalc","height=400,width=640,noscroll,resizable");
 }
 
  function GetReceived(val,no_urut) {
      newwin = window.open("ais_transaction_custlist_2.php?FormName=[var.HTMLFormName]&no_urut="+no_urut,"toolcalc","height=400,width=640,noscroll,resizable");
 }

 function GetStaff(val,need_another_var) {
            newwin = window.open("ais_transaction_stafflist.php?FormName=[var.HTMLFormName]&need_another_var="+need_another_var,"toolcalc","height=400,width=640,noscroll,resizable");
 }


 function OpenPrincipal (number) {
        newwin = window.open("ais_transaction_receipt_entry.php?PageMode=Page2&FormName=[var.HTMLFormName]&Number="+number,"vessel","height=105,width=300,noscroll,noresizable");
 }

 function OpenRemark (number) {
        newwin = window.open("ais_transaction_dn.php?PageMode=Remark&FormName=[var.HTMLFormName]&Number="+number,"remarks","height=105,width=300,noscroll,noresizable");
 }

 function OpenPrint (number) {
        newwin = window.open("ais_transaction_dn.php?PageMode=PrintPreview&nobkt="+number,"print","height=650,width=600,noscroll,noresizable");
 }


 function GetSkada() {
         skada1 = document.[var.HTMLFormName].thbl.value;
         if (skada1.length) LoadRPC ("iLoader", "[var.FileName]", "thbl="+document.[var.HTMLFormName].thbl.value);
 }


 function GetTotal () {
         document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");
 }


 /* added by dyah <dyah.mahrani@gmail.com>
 * 23 juli 2009
 * desc: COA filter based on group <payable/receivable>
 * */


 function getCashType(){
    var frm = document.[var.HTMLFormName].cash_type;
    return frm.options[frm.selectedIndex].value;
 }

var reccount = 1;
//if (reccount==0) reccount=1; else reccount=5;
var last;

function AddFormGridProject (cname,firstelemen) {
	var lastname ="";
    if (VerifyGridProject(reccount)==false) {
        return false
    }

    $(".gridBox:visible").each(function(n) {
        n = n+1;
        reccount = n;
        lastname = this.name;
    });
    
    lastname = lastname.substring(8);
    
    lastname = parseInt(lastname)+1;
    
    //reccount = 5;
    reccount = parseInt(reccount)+1;

    //alert("reccount: " + reccount);

    if (reccount>=100) {
        cname.disabled = true;
    }

    var objrow = document.getElementById(lastname);

    if (objrow.style.display == 'none') {
        objrow.style.display = '';
    }

    eval(firstelemen+''+lastname+'.focus()');

    return false;
}







function VerifyGridProject (x) {
    err_message = '';
    last_focus =0;
    if (err_message.length) {//alert(err_message);
    return false} else return true
}

function VerifyGridCargo (x) {
    err_message = '';
    last_focus =0;
    if (err_message.length) {//alert(err_message);
    return false} else return true
}

function CheckAllGrid(firstelemen) {
        for (n=1;n<reccount;n++) {
                if (!VerifyGrid(n)) return false;
        }
        eval('fl = document.'+firstelemen+reccount+'.value');
        if (fl.length)
                if (!VerifyGrid(reccount)) return false;
return true;}

 function GetReceived(val) {

     var getProjectValue = document.getElementById('projectname').value;

    //alert(getProjectValue);

     switch (val){
        case "1":
            newwin = window.open("ais_transaction_custlist_2.php?FormName=[var.HTMLFormName]&SendToBack=1&PageMode=Test&ProjectId=" + getProjectValue ,"toolcalc","height=400,width=640,noscroll,resizable");
            break;
     }
 }

 </script>


</html>
